package com.kexilo.core.audit.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kexilo.core.common.core.domain.BaseEntity;

/**
 * 数据归档配置表 kx_sys_archive_config
 *
 * @author Kexilo
 */
@TableName("kx_sys_archive_config")
public class SysArchiveConfig extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** 配置ID */
    @TableId(type = IdType.AUTO)
    private Long configId;

    /** 配置名称 */
    private String configName;

    /** 表名 */
    private String tableName;

    /** 归档条件（SQL WHERE条件） */
    private String archiveCondition;

    /** 保留天数 */
    private Integer retentionDays;

    /** 是否启用（0:禁用 1:启用） */
    private String status;

    /** 执行频率（cron表达式） */
    private String cronExpression;

    /** 批处理大小 */
    private Integer batchSize;

    /** 是否备份到文件（0:否 1:是） */
    private String backupToFile;

    /** 备份文件路径 */
    private String backupPath;

    /** 归档后是否删除原数据（0:否 1:是） */
    private String deleteAfterArchive;

    /** 备注 */
    private String remark;

    public SysArchiveConfig() {
    }

    // Getter and Setter methods
    public Long getConfigId() {
        return configId;
    }

    public void setConfigId(Long configId) {
        this.configId = configId;
    }

    public String getConfigName() {
        return configName;
    }

    public void setConfigName(String configName) {
        this.configName = configName;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getArchiveCondition() {
        return archiveCondition;
    }

    public void setArchiveCondition(String archiveCondition) {
        this.archiveCondition = archiveCondition;
    }

    public Integer getRetentionDays() {
        return retentionDays;
    }

    public void setRetentionDays(Integer retentionDays) {
        this.retentionDays = retentionDays;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getCronExpression() {
        return cronExpression;
    }

    public void setCronExpression(String cronExpression) {
        this.cronExpression = cronExpression;
    }

    public Integer getBatchSize() {
        return batchSize;
    }

    public void setBatchSize(Integer batchSize) {
        this.batchSize = batchSize;
    }

    public String getBackupToFile() {
        return backupToFile;
    }

    public void setBackupToFile(String backupToFile) {
        this.backupToFile = backupToFile;
    }

    public String getBackupPath() {
        return backupPath;
    }

    public void setBackupPath(String backupPath) {
        this.backupPath = backupPath;
    }

    public String getDeleteAfterArchive() {
        return deleteAfterArchive;
    }

    public void setDeleteAfterArchive(String deleteAfterArchive) {
        this.deleteAfterArchive = deleteAfterArchive;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    /**
     * 判断是否启用
     */
    public boolean isEnabled() {
        return "1".equals(this.status);
    }

    /**
     * 判断是否需要备份到文件
     */
    public boolean needBackupToFile() {
        return "1".equals(this.backupToFile);
    }

    /**
     * 判断归档后是否删除原数据
     */
    public boolean shouldDeleteAfterArchive() {
        return "1".equals(this.deleteAfterArchive);
    }
}
